import utils.SortUtil;

import java.util.Arrays;
import java.util.Comparator;

public class Test {

    public static void main1(String[] args) {
        Student[] students = new Student[5];
        AgeComparator ageComparator = new AgeComparator();

        students[0] = new Student("djm", 22);
        students[1] = new Student("lsm", 23);
        students[2] = new Student("zzx", 23);
        students[3] = new Student("tl", 23);
        students[4] = new Student("fjh", 22);

        System.out.println("排序之前");
        for (Student student : students) {
            System.out.println(student);
        }

        Arrays.sort(students,ageComparator);
        System.out.println("排序之后");
        for (Student student : students) {
            System.out.println(student);
        }
    }

    public static void main(String[] args) {
        Student[] students = new Student[5];

        students[0] = new Student("djm", 22);
        students[1] = new Student("lsm", 23);
        students[2] = new Student("zzx", 23);
        students[3] = new Student("tl", 23);
        students[4] = new Student("fjh", 22);

        System.out.println("排序之前");
        for (Student student : students) {
            System.out.println(student);
        }

        SortUtil.bubblesort((Comparator[]) students);

        System.out.println("排序之后");
        for (Student student : students) {
            System.out.println(student);
        }
    }
}
